import Util from "../../util/Util"
const user = {
    state: {
      token: null,
      menus:[],
      menusMap:null,
      vues:[],
    },
    mutations: {
        login(state,_token) {
            state.token = _token;
        },
        logout (state) {
            state.token = null;
            state.menus = [];
            state.menusMap = null;
        },
        setMenus (state,_menus){
            state.menus = _menus;
            let menusMap = Util.menusConvertToMap(_menus);
            state.menusMap = menusMap;
        }
    }
};

export default user;
